﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Models;
using System.Data;
using System.Data.SqlClient;
namespace DAL
{
   public class ChaDAL
    {
       //登录查询是否有该账号
       public static DataTable Cha(Models.Consumer1 cus)
       {
           string sql = string.Format("select * from Consumer1 where Phone='{0}' and PassWord='{1}' ", cus.Phone, cus.PassWord);
           return DBhelper.Cha(sql);
       }
       //根据手机号和密码查询该用户的昵称
       public static string ChaName(Models.Consumer1 cus)
       {
           string sql = string.Format("select Name from Consumer1 where Phone='{0}' and PassWord='{1}' ", cus.Phone, cus.PassWord);
           return DBhelper.Cha(sql).Rows[0]["Name"].ToString();
       }

       //根据姓名查询改用户的信息资料
       public static DataTable ChaZiLiao(string name)
       {
           string sql = string.Format("select * from Consumer1 where Name='{0}'",name);
           return DBhelper.Cha(sql);
       }
       //查询所有商品
       public static DataTable sp()
       {
           string sql = "select * from Goods";
           return DBhelper.Cha(sql);
       }
    }
}
